package cate.game.play.skill.passive.exp;

import cate.common.table.d.GDSkill;
import cate.common.util.XT;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * 每次攻击后附带自身攻击力10%的真实伤害;每回合开始前有30%概率提升自身30%攻击力，同时降低自身15%伤害减免和20%防御,可驱散，冷却3回合
 */
public class 背水临渊PH extends PassiveHandler {

	private double 攻击系数;

	private int 概率;

	private int buff;

	//攻击系数=1000&概率=3000&buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		攻击系数 = args.getWDouble("攻击系数", 0d);
		概率 = args.getInt("概率", 0);
		buff = args.getInt("buff", 0);
	}

	@Override
	public void afterOneAttack(SkillActionCtx action, long totalDamage, boolean strike, Fighter target) {
		target.attr.passiveHurt(action, skill.owner, skill.owner.attr.attTotal() * 攻击系数, GDSkill.Nature.REAL);
	}

	@Override
	public void onRoundBegin(ActionCtx action) {
		if (XT.chance(概率)) {
			skill.owner.buff.tryAddByTid(action, buff);
		}
	}
}
